package com.xuyuan.arithmetic.datastructure;


import java.util.HashMap;
import java.util.Map;

public class TestDS {
    public static void main(String[] args) {
        Map<Integer, Integer> map = new HashMap<>();
        map.putIfAbsent(1, 1);
        map.putIfAbsent(1, 2);
        map.forEach((k, v) -> System.out.println(k + ":" + v));
        Integer s = map.computeIfAbsent(2, k -> k + 10);
        map.forEach((k, v) -> System.out.println(k + ":" + v));
        Integer s1 = map.computeIfPresent(1, (k, v) -> v + 10);
        map.forEach((k, v) -> System.out.println(k + ":" + v));
    }
}
